package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	MySQLConfig
}
type MySQLConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

var AppConf AppConfig

func InitConfig() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("配置读取失败", err)
		return
	}
	viper.Unmarshal(&AppConf)
	fmt.Println(AppConf)
}
